layui.use(['layer', 'form', 'laydate'], function() {

    var layer = layui.layer
        ,form = layui.form
        ,laydate = layui.laydate;

    laydate.render({
        elem: '#birthday'
    });

    $(function() {
        form.on('submit(formDemo)', function(data) {
            var uId = $(".uId").val();
            var uName = $(".uName").val();
            var uSex = $(".uSex:checked").val();
            var date = $("#birthday").val();
            var uPhone = $(".uPhone").val();
            var uIco = $("#uIco").val();
            var uEmail = $(".uEmail").val();

            $.ajax({
                url:"/admin/updateOther",
                type:"put",
                data:{uId:uId,uName:uName,uSex:uSex,uPhone:uPhone,uBirthday:date,uIco:uIco,uEmail:uEmail},
                success:function (result) {
                    if (result.code == 200){
                        //注册成功
                        layer.msg(result.msg);
                        setTimeout(function () {
                            //调用父页面的方法
                            parent.tools.reloadTable();
                            //当你在iframe页面关闭自身时
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                        }, 1500);
                    } else {
                        layer.msg(result.msg);
                    }
                }
            });
            return false;
        });

    })
});